#!/bin/bash

# 打印logo和描述信息
logo=$(cat <<'EOF'
  ____  _   _                       _   _             _                          / __ \| | | |                     | | | |           | |
| |  | | |_| |__   ___ _ __    __ _| |_| |_ __ _  ___| | __
| |  | | __| '_ \ / _ \ '__|  / _` | __| __/ _` |/ __| |/ /
| |__| | |_| | | |  __/ |    | (_| | |_| || (_| | (__|   <
 \____/ \__|_| |_|\___|_|     \__,_|\__|\__\__,_|\___|_|\_\
EOF
)
echo -e "$logo"

# Define file dictionary
declare -A files
files=(
        ["1"]="ddos/Other_attack/DNS_Amplification.py"
        ["2"]="ddos/Other_attack/RUDY_Attack.py"
        ["3"]="ddos/Other_attack/Sip_Register_Flood.py"
        ["4"]="ddos/Other_attack/Sip_lnvite_Flood.py"
        ["5"]="ddos/Other_attack/Smurf_attack.py"
        ["6"]="ddos/Other_attack/Replay_Attack.py"
)

# Create a menu using whiptail
while true; do
        choice=$(whiptail --title "Other Attack Types" --menu "Please select an attack type:" 15 70 8 \
        "1" "DNS Amplification" \
        "2" "RUDY Attack" \
        "3" "SIP Register Flood (requires sippy library)" \
        "4" "SIP Invite Flood" \
        "5" "Smurf Attack" \
        "6" "Replay Attack" \
        "0" "Back" \
        3>&1 1>&2 2>&3)

        if [[ $? -eq 0 ]]; then
                if [[ "$choice" == "0" ]]; then
                        echo "Operation cancelled."
                        break
                else
                        python3 "${files[$choice]}"
                        break
                fi
        else
                echo "Operation cancelled."
                break
        fi
done
